package com.kymatrix.mpo.plus.bpm.server.model.form.expression;

import com.alibaba.excel.annotation.ExcelProperty;
import com.kymatrix.mpo.plus.bpm.server.model.entity.definition.BpmProcessExpressionEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.experimental.Accessors;

@ApiModel(value = "管理后台 - BPM 流程表达式 Response")
@Data
@Accessors(chain=true)
public class QueryBpmProcessExpressionResp {

    @ApiModelProperty(value = "id", example = "3870")
    @ExcelProperty("id")
    private String id;

    @ApiModelProperty(value = "表达式名字", example = "李四")
    @ExcelProperty("表达式名字")
    private String name;

    @ApiModelProperty(value = "表达式状态 EnableType", example = "1")
    private String status;

    @ApiModelProperty(value = "表达式")
    private String expression;

    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    public static QueryBpmProcessExpressionResp fromEntity(BpmProcessExpressionEntity entity) {
        if (entity == null) {
            return null;
        }
        QueryBpmProcessExpressionResp resp = new QueryBpmProcessExpressionResp();
        resp.setId(entity.getId());
        resp.setName(entity.getName());
        resp.setStatus(entity.getStatus());
        resp.setExpression(entity.getExpression());
        resp.setCreateTime(entity.getCreateTime());
        return resp;
    }
}
